package com.simple.trade.service.vm;

import com.fasterxml.jackson.core.JsonProcessingException;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;

/**
 * @author yasud
 * @date 2020年10月12日 09:22
 * @description
 **/
public interface CallbackHandler {

    /**
     * 处理固定地址回调
     * @param request
     * @param channelFlag
     * @param isRefund
     * @param param
     * @return
     * @throws IOException
     */
    String handleFix(HttpServletRequest request, String channelFlag, Boolean isRefund, Map<String, Object> param) throws IOException;

    /**
     * 处理webhook
     * @param request
     * @param channelFlag
     * @return
     * @throws IOException
     */
    String handleWebhook(HttpServletRequest request, String channelFlag, Map<String, Object> pathParam) throws IOException;

    /**
     * 处理字段传递地址回调
     * @param request
     * @param flag
     * @param tradeNo
     * @return
     * @throws IOException
     */
    String handleDynamic(HttpServletRequest request, Long tradeNo,Boolean flag, Long refundTradeInventory, Map<String, Object> param) throws IOException;

    /**
     * 处理字段传递地址回调
     * @param request
     * @param param
     * @param tradeNo
     * @return
     * @throws IOException
     */
    String handleDynamic(HttpServletRequest request, Long tradeNo, Long refundTradeInventory, Map<String, Object> param) throws IOException;

    /**
     * 重新发送
     * @param notifyChannelId
     * @throws JsonProcessingException
     */
    void reSendNotify(Long notifyChannelId) throws JsonProcessingException;
}
